Brushless 5 Click
Brushless 5 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Nikola Peric
- Date : Feb 2022.
- Type : PWM type
Software Support
Example Description
This library contains an API for the Brushless5 Click driver. This example showcases how to initialize and use the Brushless 5 Click. The Click has a brushless 5 motor driver which controls the work of the motor through the BLDC terminal. In order for this example to work a motor and a power supply are needed.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.Brushless5
Example Key Functions
- brushless5_cfg_setup Config Object Initialization function.
void brushless5_cfg_setup(brushless5_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition brushless5.h:119
- brushless5_init Initialization function.
BRUSHLESS5_RETVAL brushless5_init(brushless5_t *ctx, brushless5_cfg_t *cfg)
Initialization function.
Click ctx object definition.
Definition brushless5.h:99
- brushless5_set_duty_cycle Generic sets PWM duty cycle.
void brushless5_set_duty_cycle(brushless5_t *ctx, float duty_cycle)
Generic sets PWM duty cycle.
- brushless5_pwm_stop Stop PWM module.
void brushless5_pwm_stop(brushless5_t *ctx)
Stop PWM module.
- brushless5_pwm_start Start PWM module.
void brushless5_pwm_start(brushless5_t *ctx)
Start PWM module.
Application Init
Initializes the GPIO driver and configures the PWM peripheral for controlling the speed of the motor.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
Delay_ms ( 100 );
Delay_ms ( 100 );
log_info( &logger, "---- Application Task ----" );
Delay_ms ( 1000 );
}
#define BRUSHLESS5_MAP_MIKROBUS(cfg, mikrobus)
Definition brushless5.h:66
void application_init(void)
Definition main.c:40
Application Task
This is an example that demonstrates the use of a Brushless 5 Click board. Brushless 5 Click communicates with the register via the PWM interface.
Increases and decreasing the speed of the motor demonstrate speed control. Results are being sent to the Usart Terminal where you can track their changes.
{
static int8_t duty_cnt = 1;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
log_printf( &logger, "Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
Delay_ms ( 500 );
if ( 10 == duty_cnt )
{
duty_inc = -1;
log_printf( &logger, " Slowing down... \r\n" );
}
else if ( 0 == duty_cnt )
{
duty_inc = 1;
log_printf( &logger, " Increasing the motor speed... \r\n" );
}
duty_cnt += duty_inc;
Delay_ms ( 500 );
}
void application_task(void)
Definition main.c:72
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.